//
//  NSString+category.m
//  MobileLier
//
//  Created by caoshuaikun on 16/10/25.
//  Copyright © 2016年 com.Mobilizer.name. All rights reserved.
//

#import "NSString+category.h"

@implementation NSString (category)
+ (NSMutableAttributedString *)changeTextColor:(NSString*)string OneColor:(UIColor *)oneColor TwoColor:(UIColor *)twoColor Range:(NSRange)range {
    
    NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:string];
    
    NSRange totalRange = NSMakeRange(0, string.length);
    [attrString addAttribute:NSForegroundColorAttributeName value:oneColor range:totalRange];
    
    [attrString addAttribute:NSForegroundColorAttributeName value:twoColor range:range];
    
    return attrString;
    
}

+ (NSMutableAttributedString *)changeTextColor:(NSString*)string OneColor:(UIColor *)oneColor TwoColor:(UIColor *)twoColor oneFontSize:(CGFloat)oneFontSize twoFontSize:(CGFloat)twoFontSize Range:(NSRange)range {
    NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:string];
    NSRange totalRange = NSMakeRange(0, string.length);
    [attrString addAttribute:NSForegroundColorAttributeName value:oneColor range:totalRange];
    [attrString addAttribute:NSForegroundColorAttributeName value:twoColor range:range];
    [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:oneFontSize] range:totalRange];
    [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:twoFontSize] range:range];
    return attrString;
}

@end
